<?php

namespace App\Admin\Renderable;


use App\Models\SwtEmployee;
use App\Models\SwtMachine;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;

class EmployeeRenderable extends LazyRenderable
{
    public function grid(): Grid
    {
        // 获取外部传递的参数


        $type = $this->type ;

        return Grid::make(new SwtEmployee(), function (Grid $grid) use ($type) {

            $grid->column('id');

            $grid->column('name','员工姓名') -> display(function ($value) {
                return $value ?? '-';
            });

            $grid->quickSearch(['employee_name']);

            $grid->paginate(10);

            $grid->disableRowSelector(false);

            $grid->model()->where('type', '=', $type);


            $grid->disableActions();
        });
    }
}
